#ifndef AUDIORESAMPLER_H
#define AUDIORESAMPLER_H
#include "AV_Common.h"
extern "C"
{
#include"libswresample/swresample.h"
}
class AudioResampler
{
public:
    AudioResampler();
     ~AudioResampler();
public:
     void Close();
    int Convert(AVFramePtr in_frame,AVFramePtr& out_frame);
     bool Open(int in_samplrate,int in_channels,AVSampleFormat in_fmt,
              int out_samplrate,int out_channels,AVSampleFormat out_fmt);
private:
     SwrContext* swr_Context_= nullptr;
    int in_samplerate_ =0;
     int in_channles_= 0;
    int in_bits_per_sample_=0;
     AVSampleFormat in_fmt_= AV_SAMPLE_FMT_NONE;

    int out_samplerate_=0;
     int out_channles_=0;
    int out_bits_per_sample_=0;
     AVSampleFormat out_fmt_= AV_SAMPLE_FMT_NONE;
};

#endif // AUDIORESAMPLER_H
